<include file="public@header" />
<style>
	.down_item{
		width: 300px;
		display: block;
		padding-left:20px;
		line-height: 30px;
	}
</style>
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="{:url('product')}">产品库列表</a></li>
			<if condition="auth_check('donesq_lists')">
				<li><a href="{:url('donesq_lists')}">成交库申请列表</a></li>
			</if>
		</ul>
		<form class="well form-inline margin-top-20" method="post" action="{:url('product')}">
			类别:
			<select class="form-control" name="category" style="width: 120px;">
				<option value='-1'>全部</option>
				<volist name="cate" id="vo">
					<option value="{$vo.id}" <eq name="vo.id" value="$where_r.category|default=-1">selected</eq> >{$vo.name}</option>
				</volist>
			</select> &nbsp;
			关键字:
			<input type="text" class="form-control" name="keyword" style="width: 150px;"
				   value="{$where_r.keyword|default=''}" placeholder="请输入关键字...">
			未跟进天数:
			<input type="number" class="form-control" name="day" style="width: 60px;"
				   value="{$where_r.day|default=''}">
			转让类型:
			<select class="form-control" name="attorn" style="width: 120px;">
				<option value='0'>全部</option>
				<volist name="attorn" id="vo">
					<option value="{$vo.id}" <eq name="vo.id" value="$where_r.attorn|default=0">selected</eq> >{$vo.name}</option>
				</volist>
			</select> &nbsp;
			注册资本:
			<div class="input-group">
				<input type="number" class="form-control" name="min_registered_capital" value="{:input('min_registered_capital/s')}" style="width: 80px;">
				<span class="input-group-addon">—</span>
				<input type="number" class="form-control" name="max_registered_capital" value="{:input('min_registered_capital/s')}" style="width: 80px;">
			</div>
			&nbsp;
			成立年限:
			<select class="form-control" name="regtime" style="width: 80px;">
				<option value='0'>不限</option>
				<option value='1' <eq name=":input('regtime')" value="1">selected</eq> >1年内</option>
				<option value='2' <eq name=":input('regtime')" value="2">selected</eq> >1-2年</option>
				<option value='3' <eq name=":input('regtime')" value="3">selected</eq> >2-3年</option>
				<option value='4' <eq name=":input('regtime')" value="4">selected</eq> >3-5年</option>
				<option value='5' <eq name=":input('regtime')" value="5">selected</eq> >5-10年</option>
				<option value='6' <eq name=":input('regtime')" value="6">selected</eq> >10年以上</option>
			</select> &nbsp;
			<input type="submit" class="btn btn-primary" value="搜索"/>
			<a class="btn btn-danger" href="{:url('index')}">清空</a>
		</form>
		<form class="js-ajax-form" action="" method="post">
		<div class="table-actions">
			<if condition="auth_check('unlock_se')">
			<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"
					data-action="{:url('unlock_se')}">解锁
			</button>
			</if>
		</div>
		<table class="table table-hover table-bordered">
			<thead>
				<tr>
					<th width="15">
						<label>
							<input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
						</label>
					</th>
					<!-- <th width="50">ID</th> -->
					<th>企业名称</th>
					<!--<th>法定代表人</th>-->
					<th>锁定时间</th>
					<th>注册资本</th>
					<!--<th>地址</th>-->
					<!--<th>邮箱</th>-->
					<!--<th>电话号码</th>-->
					<!--<th>经营范围</th>-->
					<!--<th>备注</th>-->
					<th>收购价</th>
					<th>售价</th>
					<th>开发人</th>
					<th>录入人</th>
					<th>转让类型</th>
					<th>项目情况</th>
					<th>跟进</th>
					<!--<th>最近跟进时间</th>-->
					<!--<th>下次跟进时间</th>-->
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<foreach name="lists" item="vo">
				<tr>
					<td>
						<input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
							   value="{$vo.id}" title="ID:{$vo.id}">
					</td>
					<!-- <td>{$vo.id}</td> -->
					<td data-toggle="collapse" data-parent="#accordion" data-target="#list-{$vo.id}">{$vo.company}</td>
					<!--<td>{$vo.corporation}</td>-->
					<td>{$vo.lock_time|date="Y-m-d",###}</td>
					<td>{$vo.registered_capital|floatval}万{$vo.cname}</td>
					<!--<td>{$vo.address}</td>-->
					<!--<td>{$vo.email}</td>-->
					<!--<td>{$vo.phone}</td>-->
					<!--<td>{$vo.scope}</td>-->
					<!--<td class="remark">{$vo.remark}</td>-->
					<td>{$vo.price}</td>
					<td>{$vo.selling_price}</td>
					<td>{$vo.user_nickname}</td>
					<td>{$vo.pname}</td>
					<td>{$vo.aname}</td>
					<td>
						<switch name="vo.abutment">
							<case value="0">无</case>
							<case value="1">项目进行中</case>
							<case value="2">项目完成</case>
						</switch>
					</td>
					<td>{$vo.evolve}</td>
					<!--<td>
						<eq name="vo.newtime" value="0">
							无
							<else/>
							{$vo.newtime|date="Y-m-d H:i:s",###}
						</eq>
					</td>
					<td>
						<eq name="vo.nexttime" value="0">
							无
							<else/>
							{$vo.nexttime|date="Y-m-d H:i:s",###}
						</eq>
					</td>-->
					<td>
						<if condition="auth_check('follow')">
							<a href='javascript:parent.openIframeLayer("{:url("resource_library/follow",["pid" => $vo["id"]])}","资源跟进记录")'>跟进</a>
						</if>
						<if condition="auth_check('unlock_se')">
							<a href='{:cmf_url("unlock_se",["id" => $vo["id"]])}' class="js-ajax-dialog-btn"
							   data-msg="是否解锁该条记录？">解锁</a>
						</if>
							<a href='javascript:show({$vo.id});'>查看</a>
							<a href='{:cmf_url("done",["id" => $vo["id"]])}' class="js-ajax-dialog-btn"
							   data-msg="是否成交该条记录？">成交</a>
					</td>
				</tr>
				<tr>
					<td colspan="11">
						<ul id="list-{$vo.id}" class="panel-collapse collapse default-ul clearfix">
							<li class="col-md-3">法定代表人:{$vo.corporation}</li>
							<li class="col-md-5">地址:{$vo.address}</li>
							<li class="col-md-2">邮箱:{$vo.email}</li>
							<li class="col-md-2">电话号码:{$vo.phone}</li>
							<li class="col-md-6">最近跟进时间：<eq name="vo.newtime" value="0">
								无
								<else/>
								{$vo.newtime|date="Y-m-d H:i:s",###}
							</eq></li>
							<li class="col-md-6">下次跟进时间：<eq name="vo.nexttime" value="0">
								无
								<else/>
								{$vo.nexttime|date="Y-m-d H:i:s",###}
							</eq></li>
							<li class="col-md-12">经营范围:{$vo.scope}</li>
							<li class="col-md-12">备注:{$vo.remark}</li>
						</ul>
					</td>
				</tr>
				</foreach>
			</tbody>
		</table>
		<div class="table-actions">
			<if condition="auth_check('unlock_se')">
			<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"
					data-action="{:url('unlock_se')}">解锁
			</button>
			</if>
		</div>
		<div class="pagination">{$page}<li><a>共计 {$lists->total()} 条</a></li><li>
			<input class="page" type="text" name="pageNum" value="{$lists->getCurrentPage()}"/>
			<a class="topage" data-url="{$lists->getCurrentPath()}">跳转</a>
			</li></div>
		</form>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
<script>
    function show(id) {
        $.ajax({
			url:'{:cmf_url("files")}',
			type:'post',
			data:{id:id},
			success:function(data){
                Wind.css('layer');
                Wind.use("layer", function () {
                    html='';
                    if(data.data === null) {
                        layer.alert('该数据未上传文件！', {
                            icon: 1,
                            title: '提示',
                            skin: 'layer-ext-moon'
                        })
						return;
					}
                    $.each(data.data,function(key,item){
                        html += '<a class="down_item" href="'+item.url+'">'+item.name+'</a>';
					})
                    if(html === '') {
                        layer.alert('该数据未上传文件！', {
                            icon: 1,
                            title: '提示',
                            skin: 'layer-ext-moon'
                        })
                    }else{
                        layer.open({
                            type: 1,
                            skin: 'layui-layer-demo', //样式类名
                            closeBtn: 0, //不显示关闭按钮
                            anim: 2,
                            shadeClose: true, //开启遮罩关闭
                            title:'文件查看',
                            content: html
                        });
                    }
                });
			}
		})
    }
</script>
</body>
</html>